<?php

	include '../utils/_connection.php';
	$var = conectar();
	session_start();

	$id = $_GET['id'];

	$sql = "SELECT * FROM coauthors WHERE id_coauthor='$id'";
	$res = mysql_query($sql);
	$obj = mysql_fetch_object($res);

	if ($_POST['name'] != "")
		$obj->name = $_POST['name'];

	if ($_POST['center'] != "")
		$obj->center = $_POST['center'];

	if ($_POST['degree'] != "")
		$obj->degree = $_POST['degree'];

	if ($_POST['bios'] != "")
		$obj->bios = $_POST['bios'];

	$sql = "UPDATE `coauthors` 
			SET `name`= '$obj->name' ,
				`center`= '$obj->center' ,
				`degree`= '$obj->degree' ,
				`bios`= '$obj->bios' 
			WHERE id_coauthor='$id' ";

	mysql_query($sql);

	header("Location: /backend/autor/coauthor.php");

?>